﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace ImageRecognition2.Action
{
    /// <summary>
    /// Action for rotating or mirroring
    /// </summary>
    public class ActionRotateOrMirroring : AbstractCommand
    {
        //private PictureBox m_PictureBox = null;
        //private short m_shType = -1;

        private RotateFlipType m_RotateFlipType;

        /// <summary>
        /// Initializes a new instance of the <see cref="ActionRotateOrMirroring"/> class.
        /// </summary>
        /// <param name="_rotateFlipType">Type of the _rotate flip.</param>
        public ActionRotateOrMirroring(RotateFlipType _rotateFlipType)
        {
            m_RotateFlipType = _rotateFlipType;
        }

        /// <summary>
        /// Runs the specified sender.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        public override void Run(object sender, EventArgs e)
        {
            Bitmap bitmap = (Bitmap)MainFormSingleton.ActivePictureBox.BackgroundImage;
            bitmap.RotateFlip(m_RotateFlipType);
        }   
    }
}
